import 'package:catcher/handlers/console_handler.dart';
import 'package:catcher/mode/dialog_report_mode.dart';
import 'package:catcher/mode/page_report_mode.dart';
import 'package:catcher/model/catcher_options.dart';
import 'package:catcher/model/localization_options.dart';
import 'package:flutter/material.dart';

import '../api/error_handle.dart';

class Constants {
  //SharedPreferences 存储Key值
  //用于Token存储
  static const Widget empty = const SizedBox.shrink();

  static const String BASE_URL = "https://api.loxen.cn";
  // static const String BASE_URL = "http://192.168.31.237:8888";

//  static const String BASE_URL = "http://192.168.31.101:8888";

  static const String BD_KEY = 'o2TCBpc8VkSNrPZruyyBBGfi05RMEnYl';

  static const String PHONE = 'phone';
  static const String ACCESS_TOKEN = 'accessToken';
  static const String REFRESH_TOKEN = 'refreshToken';
  static const String FIRST = 'first';
  static const String agreePolicy = 'agreePolicy';

  //默认地址选择
  static const String DEFAULT_ADDRESS_INDEX = 'default_address_index';

  static const String SEARCH_INSPIRATION_CACHE = 'search_inspiration_cache';
  static const String SEARCH_MATERIAL_CACHE = 'search_material_cache';
  static const String SEARCH_KNOWLEDGE_CACHE = 'search_knowledge_cache';
  static const String SEARCH_CASE_CACHE = 'search_case_cache';

  static Widget loadingIcon() {
    return Constants.empty;
  }

  //Debug异常日志配置
  static CatcherOptions debugOptions = CatcherOptions(
    PageReportMode(),
    [
      ConsoleHandler(
          enableApplicationParameters: false,
          enableDeviceParameters: false,
          enableCustomParameters: true,
          enableStackTrace: false),
      MyReportHandler()
    ],
    localizationOptions: [
      LocalizationOptions("zh",
          notificationReportModeTitle: "发生应用错误",
          notificationReportModeContent: "单击此处将错误报告发送给支持团队。",
          dialogReportModeTitle: "哎呀出错了",
          dialogReportModeDescription: "抱歉影响到您正常体验，已经准备拿一个程序员祭天熄灭您的怒火。请点击发送这对我们很重要，感谢。",
          dialogReportModeAccept: "发送",
          dialogReportModeCancel: "取消",
          pageReportModeTitle: "紧急",
          pageReportModeDescription: "抱歉影响到您正常体验，已经准备拿一个程序员祭天熄灭您的怒火。请点击发送这对我们很重要，感谢。",
          pageReportModeAccept: "发送",
          pageReportModeCancel: "取消")
    ],
  );

  //Release异常日志配置
  static CatcherOptions releaseOptions = CatcherOptions(
    DialogReportMode(),
    [MyReportHandler()],
    localizationOptions: [
      LocalizationOptions("zh",
          notificationReportModeTitle: "发生应用错误",
          notificationReportModeContent: "单击此处将错误报告发送给支持团队。",
          dialogReportModeTitle: "哎呀出错了",
          dialogReportModeDescription: "抱歉影响到您正常体验，已经准备拿一个程序员祭天熄灭您的怒火。请点击发送这对我们很重要，感谢。",
          dialogReportModeAccept: "发送",
          dialogReportModeCancel: "取消",
          pageReportModeTitle: "紧急",
          pageReportModeDescription: "抱歉影响到您正常体验，已经准备拿一个程序员祭天熄灭您的怒火。请点击发送这对我们很重要，感谢。",
          pageReportModeAccept: "发送",
          pageReportModeCancel: "取消")
    ],
  );
}
